import request from '@/utils/request'
// 获取面经列表
export const Article = (data) => {
  const requestOption = {
    url: '/h5/interview/query',
    params: {
      current: data.current || 1,
      pageSize: data.pageSize || 10
    }
  }
  if (data.sorter) {
    requestOption.params.sorter = data.sorter
  }
  return request(requestOption)
}
// 面经详情页
export const ArticleDetail = (id) => {
  return request({
    url: '/h5/interview/show',
    params: { id: id }
  })
}
// 收藏、点赞
export const updateLike = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 1 // 喜欢
  })
}

export const updateCollect = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 2 // 收藏
  })
}
// 收藏列表
export const collectList = (data) => {
  return request({
    url: '/h5/interview/opt/list',
    params: {
      optType: 2,
      pageSize: 10,
      page: data.page
    }
  })
}
// 点赞列表
export const likeList = (data) => {
  return request({
    url: '/h5/interview/opt/list',
    params: {
      optType: 1,
      pageSize: 10,
      page: data.page
    }
  })
}
